﻿Public Class BlockThreeHomeworkSectionTen
    Dim QuestionNumber As Integer
    Dim dtmTest, dtmTest2 As Date
    Dim filename As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    'Declare the Array as 10 rows and 3 columns
    Dim ArrayMax As Integer = 28 'One number past the end of actual info in array
    Dim HWQuestions(ArrayMax, 7) As String
    Dim intResponse As Integer
    Dim intQuestionCount As Integer = 0
    Dim intAnswerCount As Integer = 0
    Dim intReferenceCount As Integer = 0
    Dim intFirstRun As Integer = 1
    Dim strUser As String = "Enter Last Name"
    Dim intChoiceACount As Integer = 2
    Dim intChoiceBCount As Integer = 3
    Dim intChoiceCCount As Integer = 4
    Dim intChoiceDCount As Integer = 5

    Shared Property MidiParent As MainForm

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub BlockThreeHomeworkSectionTen_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtObj.Text = "Objectives:" + vbCrLf + "- BLOCK REVIEW"
        If (System.IO.File.Exists(filename & "\Homework\Block 3\Block 3 Section 10.txt")) Then
            intResponse = MsgBox("This assignment has already been completed.  Are you sure you want to delete the current assignment and reaccomplish it?", 4, "Confirm Assignment Deletion")
            If intResponse = MsgBoxResult.Yes Then
                System.IO.File.Delete(filename & "\Homework\Block 3\Block 3 Section 10.txt")
                System.IO.File.Create(filename & "\Homework\Block 3\Block 3 Section 10.txt").Dispose()
            ElseIf intResponse = MsgBoxResult.No Then
                Me.Close()
            End If
        End If
        If (Not System.IO.File.Exists(filename & "\Homework\Block 3\Block 3 Section 10.txt")) Then
            System.IO.File.Create(filename & "\Homework\Block 3\Block 3 Section 10.txt").Dispose()
        End If
        If (Not System.IO.File.Exists(filename & "\Instructor\Block 3\Block 3 Section 10.txt")) Then
            System.IO.File.Create(filename & "\Instructor\Block 3\Block 3 Section 10.txt").Dispose()
        End If
        strUser = InputBox("Please enter last name", strUser)
        If strUser Is "" Then
            Me.Close()
        End If
        '************************************************
        '****** Questions Are Loaded Here****************
        '******* Column 1 is Questions (Preloaded)*******
        '******* Column 2 is Accepts Students Answer*****
        '******* Column 3 is Reference ******************
        HWQuestions(1, 1) = "1. (Basic Transmitter) In a basic AM transmitter, the unit which serves as the RF source is the?"
        HWQuestions(1, 2) = "Antenna"
        HWQuestions(1, 4) = "Oscillator"
        HWQuestions(1, 5) = "Modulator"
        HWQuestions(1, 6) = "Power Amplifier"
        HWQuestions(1, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(2, 1) = "2. Which of the following two units correctly make up the AN/GRT-22?"
        HWQuestions(2, 2) = "T1109 and AM-6154"
        HWQuestions(2, 4) = "T1109 and AM-6155"
        HWQuestions(2, 5) = "T1108 and AM-6154"
        HWQuestions(2, 6) = "T1108 and AM-6155"
        HWQuestions(2, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(3, 1) = "3. (GRT-22) Which of the following is a characteristic of the UHF exciter utilizing an oscillator-synthesizer?"
        HWQuestions(3, 2) = "116-149.9875 MHz"
        HWQuestions(3, 4) = "225-399.95 MHz"
        HWQuestions(3, 5) = "25-kHz spacing"
        HWQuestions(3, 6) = "680 channels"
        HWQuestions(3, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(4, 1) = "4. (T-1109 Block Diagram) The unit which serves to prevent over modulation is?"
        HWQuestions(4, 2) = "Multiplier A9."
        HWQuestions(4, 4) = "Keyer Control A2."
        HWQuestions(4, 5) = "Regulator PS1A1."
        HWQuestions(4, 6) = "Compressor AMPL A1."
        HWQuestions(4, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(5, 1) = "5. (T1109 Block Diagram) What unit produces Automatic Power Control?"
        HWQuestions(5, 2) = "Control RF/Modulator A6"
        HWQuestions(5, 4) = "Power Detector DC1"
        HWQuestions(5, 5) = "Regulator PS1A1"
        HWQuestions(5, 6) = "Power Amp A10"
        HWQuestions(5, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(6, 1) = "6. (T1109 Controls and Indicators) What control is used to adjust modulation percentage?"
        HWQuestions(6, 2) = "R1 (chassis)"
        HWQuestions(6, 4) = "R8 (chassis)"
        HWQuestions(6, 5) = "S1 (chassis)"
        HWQuestions(6, 6) = "S4 (chassis)"
        HWQuestions(6, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(7, 1) = "7. (T-1109 Power Supply) What component is used to adjust the regulated voltage?"
        HWQuestions(7, 2) = "A3"
        HWQuestions(7, 4) = "A6"
        HWQuestions(7, 5) = "AR1"
        HWQuestions(7, 6) = "R25"
        HWQuestions(7, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(8, 1) = "8. (T1109 Filter AMPL/Det A4) The A4 passes all frequencies"
        HWQuestions(8, 2) = "above 6000 Hz."
        HWQuestions(8, 4) = "below 300 Hz."
        HWQuestions(8, 5) = "in the audio range."
        HWQuestions(8, 6) = "between 300 and 6000 Hz."
        HWQuestions(8, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(9, 1) = "9. (T-1109 Buffer Modulation A5) R14 is adjusted"
        HWQuestions(9, 2) = "for maximum Q1 gain."
        HWQuestions(9, 4) = "to clip all audio peaks."
        HWQuestions(9, 5) = "for maximum +DC at TP1."
        HWQuestions(9, 6) = "to clip peaks of powerful audio signals only."
        HWQuestions(9, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(10, 1) = "10. (T-1109 Control RF/Modulation A6) (1) APC/MOD audio components is adjusted by R1 on the chassis. (2) APC/MOD DC component is adjusted by A6R19 and R8 on the chassis."
        HWQuestions(10, 2) = "Both statements are true."
        HWQuestions(10, 4) = "Both statements are false."
        HWQuestions(10, 5) = "Only statement (1) is true."
        HWQuestions(10, 6) = "Only statement (2) is true."
        HWQuestions(10, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(11, 1) = "11. (T1109 Control RF/Modulator A6) Turning R19 clockwise"
        HWQuestions(11, 2) = "decreases Exciter RF power."
        HWQuestions(11, 4) = "increases Exciter RF power."
        HWQuestions(11, 5) = "increases output of AR1."
        HWQuestions(11, 6) = "decreases APC voltage."
        HWQuestions(11, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(12, 1) = "12. (T-1109 Oscillator-Synthesizer A8) For a transmit frequency of 240 MHz."
        HWQuestions(12, 2) = "increase the Prescaler ratio."
        HWQuestions(12, 4) = "change the Reference Generator."
        HWQuestions(12, 5) = "set the 4 frequency switches to 60 MHz."
        HWQuestions(12, 6) = "set the 4 frequency switches to 240 MHz."
        HWQuestions(12, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(13, 1) = "13. (T-1109 Quadrupler A9) Turning R15 clockwise will cause"
        HWQuestions(13, 2) = "gain of Q1 to decrease."
        HWQuestions(13, 4) = "voltage P1 pin 6 to decrease."
        HWQuestions(13, 5) = "quadrupler output amplitude to increase."
        HWQuestions(13, 6) = "RF carrier frequency to increase."
        HWQuestions(13, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(14, 1) = "14. The T-1109 Driver/Power Amp A10 has how many tunable stages?"
        HWQuestions(14, 2) = "0"
        HWQuestions(14, 4) = "2"
        HWQuestions(14, 5) = "4"
        HWQuestions(14, 6) = "6"
        HWQuestions(14, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(15, 1) = "15. (T-1109 Driver A10A1) Which of the following is not a function of the Driver?"
        HWQuestions(15, 2) = "RF Amplification"
        HWQuestions(15, 4) = "Impedance Matching"
        HWQuestions(15, 5) = "Amplitude Modulation"
        HWQuestions(15, 6) = "Frequency Multiplication"
        HWQuestions(15, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(16, 1) = "16. (AFCS Keyer A3) The AFCS keyer allows keying using a"
        HWQuestions(16, 2) = "tone in local"
        HWQuestions(16, 4) = "tone in remote"
        HWQuestions(16, 5) = "voltage in local"
        HWQuestions(16, 6) = "voltage in remote"
        HWQuestions(16, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(17, 1) = "17. (T-1109 Audio Control Circuits) With S4 in the local position, by what means can the transmitter be keyed?"
        HWQuestions(17, 2) = "Carbon, or Dynamic mikes, Carrier Test"
        HWQuestions(17, 4) = "Simplex ground, or Remote mike"
        HWQuestions(17, 5) = "Special purpose keyer only"
        HWQuestions(17, 6) = "Remote mike only"
        HWQuestions(17, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(18, 1) = "18. (T-1109 A7 Module) What stage deals primarily with temperature sensing?"
        HWQuestions(18, 2) = "Q1"
        HWQuestions(18, 4) = "Q2"
        HWQuestions(18, 5) = "Q5"
        HWQuestions(18, 6) = "Q6"
        HWQuestions(18, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(19, 1) = "19. (T-1109 Control RF/Modulator A6) What component is used to zero the meter with the selector switch in the FWD power position and the set unkeyed?"
        HWQuestions(19, 2) = "R5"
        HWQuestions(19, 4) = "R8"
        HWQuestions(19, 5) = "R19"
        HWQuestions(19, 6) = "R39"
        HWQuestions(19, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(20, 1) = "20. Which of the following two units correctly make up the AN/GRT-21?"
        HWQuestions(20, 2) = "T-1109 and AM-6154"
        HWQuestions(20, 4) = "T-1109 and AM-6155"
        HWQuestions(20, 5) = "T-1108 and AM-6154"
        HWQuestions(20, 6) = "T-1108 and AM-6155"
        HWQuestions(20, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(21, 1) = "21. In which of the following characteristics does the AN/GRT-21 differ from the AN/GRT-22??"
        HWQuestions(21, 2) = "Output power"
        HWQuestions(21, 4) = "General purpose"
        HWQuestions(21, 5) = "Frequency range"
        HWQuestions(21, 6) = "Frequency accuracy"
        HWQuestions(21, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(22, 1) = "22. Which of the following Exciter modules is not replaced for conversion from UHF to VHF?"
        HWQuestions(22, 2) = "A8"
        HWQuestions(22, 4) = "A9"
        HWQuestions(22, 5) = "A10"
        HWQuestions(22, 6) = "FL2"
        HWQuestions(22, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(23, 1) = "23. (T-1108 Doubler A9) The component(s) tuned to the transmit frequency are"
        HWQuestions(23, 2) = "C5"
        HWQuestions(23, 4) = "C11"
        HWQuestions(23, 5) = "Both A and B."
        HWQuestions(23, 6) = "None of the above."
        HWQuestions(23, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(24, 1) = "24. (T-1108 Power Amp A10A2) The power amplifier is"
        HWQuestions(24, 2) = "broadband."
        HWQuestions(24, 4) = "narrowband."
        HWQuestions(24, 5) = "a 3-stage amp."
        HWQuestions(24, 6) = "operated from nominal +18 VDC."
        HWQuestions(24, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(25, 1) = "25. Which of the following is not considered to be a typical transmitter problem?"
        HWQuestions(25, 2) = "Incorrect percent of modulation"
        HWQuestions(25, 4) = "Low audio output"
        HWQuestions(25, 5) = "Frequency drift"
        HWQuestions(25, 6) = "Inability to key"
        HWQuestions(25, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(26, 1) = "26. TO Table 5-1 lists"
        HWQuestions(26, 2) = "troubleshooting procedures."
        HWQuestions(26, 4) = "test equipment and tools."
        HWQuestions(26, 5) = "module location and ID."
        HWQuestions(26, 6) = "fault diagnosis."
        HWQuestions(26, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(27, 1) = "27. When a faulty transmitter is being checked to isolate a problem, it is mandatory that its RF output be applied to a/an"
        HWQuestions(27, 2) = "power absorption device."
        HWQuestions(27, 4) = "oscilloscope."
        HWQuestions(27, 5) = "multimeter."
        HWQuestions(27, 6) = "dB meter."
        HWQuestions(27, 3) = "Student Workbook Page 12, Section 3"

        HWQuestions(28, 1) = "Close"

        Next_Question(HWQuestions)
    End Sub

    Private Sub btnNextQuestion_Click(sender As System.Object, e As System.EventArgs) Handles btnNextQuestion.Click
        Next_Question(HWQuestions)
    End Sub
    Private Sub Clear_Display()
        txtQuestion.Clear()

    End Sub

    Public Function Next_Question(HWQuestions As String(,))

        If intQuestionCount > 0 Then
            WriteToFile()
        End If
        If btnNextQuestion.Text = "Done" Then
            Me.Close()
            OpenResults()
        End If
        intQuestionCount = intQuestionCount + 1
        If intQuestionCount = 27 Then
            btnNextQuestion.Text = "Done"
        End If
        txtQuestion.Text = HWQuestions(intQuestionCount, 1)
        txtChoiceA.Text = HWQuestions(intQuestionCount, 2)
        txtChoiceB.Text = HWQuestions(intQuestionCount, 4)
        txtChoiceC.Text = HWQuestions(intQuestionCount, 5)
        txtChoiceD.Text = HWQuestions(intQuestionCount, 6)

        intReferenceCount = intReferenceCount + 1
        txtReference.Text = HWQuestions(intReferenceCount, 3)

        Return intQuestionCount & intAnswerCount
    End Function

    Private Sub WriteToFile()
        Dim Integrity As String = (filename & "\Instructor\Block 3\Block 3 Section 10.txt")
        Dim Results As String = (filename & "\Homework\Block 3\Block 3 Section 10.txt")

        '***********Output to hidden file for Instructor Check***********
        If System.IO.File.Exists(Integrity) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Integrity, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine("- " & txtObj.Text)
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            If intQuestionCount > 1 Then
                If chkboxChoiceA.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  A: " & txtChoiceA.Text)
                ElseIf chkboxChoiceB.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  B: " & txtChoiceB.Text)
                ElseIf chkboxChoiceC.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  C: " & txtChoiceC.Text)
                ElseIf chkboxChoiceD.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  D: " & txtChoiceD.Text)
                End If
                hiddenWriter.WriteLine("Reference: " & txtReference.Text)
                hiddenWriter.WriteLine()
            End If
            hiddenWriter.WriteLine()
            If intQuestionCount = 27 Then
                hiddenWriter.WriteLine("Block 3 Section 10 Homework Complete")
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Integrity")
        End If

        '******Output to file for Student to review***********
        If System.IO.File.Exists(Results) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Results, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine("- " & txtObj.Text)
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            If intQuestionCount > 1 Then
                If chkboxChoiceA.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  A: " & txtChoiceA.Text)
                ElseIf chkboxChoiceB.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  B: " & txtChoiceB.Text)
                ElseIf chkboxChoiceC.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  C: " & txtChoiceC.Text)
                ElseIf chkboxChoiceD.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  D: " & txtChoiceD.Text)
                End If
            End If
            hiddenWriter.WriteLine()
            If intQuestionCount = 27 Then
                hiddenWriter.WriteLine("Block 3 Section 10 Homework Complete")
                'hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                'hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Results")
        End If

        If intQuestionCount > 0 Then
            chkboxChoiceA.CheckState = CheckState.Unchecked
            chkboxChoiceB.CheckState = CheckState.Unchecked
            chkboxChoiceC.CheckState = CheckState.Unchecked
            chkboxChoiceD.CheckState = CheckState.Unchecked
        End If

    End Sub

    Private Sub OpenResults()
        Dim p As Process = Process.Start(filename & "\Homework\Block 3\Block 3 Section 10.txt")
    End Sub
End Class
